import { ref } from "vue";
import { parseTime } from "@/utils/ruoyi";
import type { AvueCrudOption } from "@smallwei/avue";

export default function () {
  const option: AvueCrudOption = {
    rowKey: "menuId",
    align: "center",
    index: true,
    indexLabel: "序号",
    delBtn: false,
    searchShow: false,
    column: [
      {
        type: "select",
        prop: "typeId",
        label: "分类",
        dicUrl: "/api/messageType/list",
        props: {
          label: "typeName",
          value: "id",
        },
        rules: [
          {
            required: true,
            message: "请选择分类",
          },
        ],
      },
      {
        prop: "title",
        label: "标题",
        search: true,
      },
      {
        prop: "createTime",
        label: "创建时间",
        formatter: (row: any) => {
          return parseTime(row.createTime);
        },
      },
    ],
  };

  return ref(option);
}
